package domain

import (
	"vrcm/src/vrcm/common/models"
)

type CacheFilterConfig struct {
	models.Model

	TenantId     string `json:"tenant_id" gorm:"type:varchar(50);comment:租户"`
	DomainId     int    `json:"domain_id" gorm:"type:bigint unsigned;comment:域名配置id"`
	ExpireType   int    `json:"expire_type" gorm:"type:tinyint;comment:过期时间类型 1 目录 2文件后缀名 3全路径匹配 4全部文件"`
	Content      string `json:"content" gorm:"type:varchar(200);comment:内容"`
	FilterParam  string `json:"filter_param" gorm:"type:varchar(100);comment:过滤参数"`
	IgnoreFilter int    `json:"ignore_filter" gorm:"type:tinyint;comment:1.忽略参数 2全部忽略 3保留制定参数 4忽略指定参数"`
	IgnoreCase   int    `json:"ignore_case" gorm:"type:tinyint;comment:忽略大小写 1是 2否"`
	Sort         int    `json:"sort" gorm:"type:int;comment:排序"`
	Priority     int    `json:"priority" gorm:"type:int;comment:y优先级"`
	models.ModelTime
	models.ControlBy
}

func (CacheFilterConfig) TableName() string {
	return "cache_filter_config"
}

func (e *CacheFilterConfig) Generate() models.ActiveRecord {
	o := *e
	return &o
}

func (e *CacheFilterConfig) GetId() interface{} {
	return e.Id
}

type OverWriteUrl struct {
	models.Model

	TenantId      string `json:"tenant_id" gorm:"type:varchar(50);comment:租户"`
	DomainId      int    `json:"domain_id" gorm:"type:bigint unsigned;comment:域名配置id"`
	DestHost      string `json:"dest_host" gorm:"type:varchar(300);comment:目标host"`
	DestPath      string `json:"dest_path" gorm:"type:varchar(300);comment:目标路径"`
	OriginUrl     string `json:"origin_url" gorm:"type:varchar(300);comment:原始地址"`
	OverwriteKind string `json:"type" gorm:"column:overwrite_kind;type:tinyint;comment:静态替换 - static_replace ; 新增参数 - new_query ; 前置目录 - prefix_dir ; 目录替换 - dir_replace"`
	OverwriteType int    `json:"over_write_type" gorm:"column:overwrite_type;type:tinyint;comment:重写类型 1回源url重写 2请求url重写"`
	Sort          int    `json:"sort" gorm:"type:tinyint;comment:排序"`
	ExactlyMatch  string `json:"exactly_match" gorm:"type:varchar(10);comment:匹配"`
	models.ModelTime
	models.ControlBy
}

func (OverWriteUrl) TableName() string {
	return "overwrite_url"
}
